﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true"
    CodeBehind="UserManage.aspx.cs" Inherits="Hengbei.Web.UserManage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:EntityDataSource ID="edsUsers" runat="server" ConnectionString="name=HengbeiEntities"
        DefaultContainerName="HengbeiEntities" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="SiteUsers" EntityTypeFilter="SiteUser"
        Include="UserRole">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="edsRoles" runat="server" ConnectionString="name=HengbeiEntities"
        DefaultContainerName="HengbeiEntities" EnableDelete="False" EnableFlattening="False"
        EnableInsert="False" EnableUpdate="False" EntitySetName="UserRoles" EntityTypeFilter="UserRole">
    </asp:EntityDataSource>
    <asp:ScriptManager ID="smUser" runat="server">
    </asp:ScriptManager>
    <div style="text-align: center;">
        <h3>
            用户管理</h3>
    </div>
    <br />
    <br />
    <asp:Label ID="lblInsert" runat="server" CssClass="Label" Text="插入新的用户："></asp:Label>
    <br />
    <asp:DetailsView ID="dvUser" runat="server" Height="50px" Width="308px" AutoGenerateRows="False"
        CellPadding="4" DataKeyNames="ID" DataSourceID="edsUsers" ForeColor="#333333"
        GridLines="None" DefaultMode="Insert" OnItemInserted="dvUser_ItemInserted" OnItemInserting="dvUser_ItemInserting">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
        <EditRowStyle BackColor="#999999" />
        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
        <Fields>
            <asp:BoundField DataField="LoginID" HeaderText="登录名" SortExpression="LoginID" />
            <asp:BoundField DataField="Name" HeaderText="姓名" SortExpression="Name" />
            <asp:BoundField DataField="Password" HeaderText="密码" SortExpression="Password" />
            <asp:TemplateField HeaderText="生日" SortExpression="BirthDate">                
                <EditItemTemplate>
                    <asp:TextBox ID="txtBirthDate" runat="server" Text='<%# Bind("BirthDate") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Age" HeaderText="年龄" SortExpression="Age" />
            <asp:BoundField DataField="Mobile" HeaderText="电话" SortExpression="Mobile" />
            <asp:CheckBoxField DataField="Enabled" HeaderText="是否启用" />
            <asp:CommandField ShowInsertButton="True" EditText="编辑" InsertText="插入" 
                ShowCancelButton="False" UpdateText="更新" />
        </Fields>
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
    </asp:DetailsView>
    <br />
    <asp:Label ID="lblManage" runat="server" CssClass="Label" Text="管理已有用户："></asp:Label>
    <br />
    <asp:UpdatePanel ID="upUsers" runat="server">
        <ContentTemplate>
            <asp:GridView ID="gvUsers" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="edsUsers" CellPadding="4"
                ForeColor="#333333" GridLines="None" Width="100%" 
                onrowdatabound="gvUsers_RowDataBound">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID"
                        InsertVisible="False" Visible="False" />
                    <asp:CommandField ShowEditButton="True" CancelText="取消" EditText="编辑" 
                        UpdateText="保存" />
                    <asp:BoundField DataField="LoginID" HeaderText="登录名" SortExpression="LoginID" />
                    <asp:BoundField DataField="Name" HeaderText="姓名" SortExpression="Name" />
                    <asp:TemplateField HeaderText="生日" SortExpression="BirthDate">
                        <ItemTemplate>
                            <asp:Label ID="lblBirthDate" runat="server" Text='<%# Bind("BirthDate") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtBirthDate" runat="server" Text='<%# Bind("BirthDate") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="Age" HeaderText="年龄" SortExpression="Age" />
                    <asp:BoundField DataField="Mobile" HeaderText="电话" SortExpression="Mobile" />
                    <asp:CheckBoxField DataField="Enabled" HeaderText="是否启用" />
                    <asp:CommandField CancelText="" DeleteText="删除" EditText="" InsertText="" 
                        NewText="" SelectText="" ShowDeleteButton="True" UpdateText="" />
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
